package org.idea.spring.framework.mybatis;

import org.idea.spring.framework.mybatis.config.MybatisConfigRegistrar;
import org.idea.spring.framework.mybatis.mapper.IdMapper;
import org.idea.spring.framework.mybatis.mapper.UserMapper;
import org.idea.spring.framework.mybatis.properties.MybatisProperties;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;

import javax.annotation.Resource;

/**
 * @Author linhao
 * @Date created in 8:57 上午 2021/6/4
 */
@SpringBootApplication
@Import(MybatisConfigRegistrar.class)
public class Applications implements CommandLineRunner {

    @Resource
    private MybatisProperties mybatisProperties;
    @Resource
    private UserMapper userMapper;
    @Resource
    private IdMapper idMapper;

    public static void main(String[] args) {
        SpringApplication.run(Applications.class);
    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println(mybatisProperties.toString());
        System.out.println(userMapper.selectAll());
        System.out.println(idMapper.selectAll());
    }
}
